import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';
import { goodsList } from '@apps/ant-bus/src/views/business/goods/goods/api';
import {render} from "@apps/antd-admin/src/hooks/render/renderUtils";
import { RenderType } from '@pkg/setting';
export const columns: BasicColumn[] = [
  {
    title: '订单编号',
    dataIndex: 'orderNo',
    width: 180,
  },
  {
    title: '用户',
    dataIndex: 'nickName',
    width: 80,
  },
  {
    title: '电话',
    dataIndex: 'mobile',
    width: 150,
  },
  {
    title: '种类',
    dataIndex: 'orderTypeName',
    width: 90,
  },
  {
    title: '分区',
    dataIndex: 'partitionName',
    width: 160,
  },
  {
    title: '报价',
    dataIndex: 'orderAmount',
    width: 100,
  },
  {
    title: '编译原稿',
    dataIndex: 'hasFile1',
    width: 80,
    dictData: [
      { label: '未上传', value: 0},
      { label: '已上传', value: 1 },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '修改意见',
    dataIndex: 'hasFile3',
    width: 80,
    dictData: [
      { label: '无', value: 0},
      { label: '有', value: 1 },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '订单状态',
    dataIndex: 'state',
    width: 80,
    dictData: [
      { label: '待报价', value: 0},
      { label: '已报价', value: 1 },
      { label: '已支付', value: 2 },
      { label: '编译中', value: 3 },
      { label: '待确认', value: 4 },
      { label: '已完成', value: 5 },
      { label: '已取消', value: 100 },
    ],
    renderType: RenderType.DICT,
  },

  {
    title: '订单日期',
    dataIndex: 'createTime',
    width: 150,
  }
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'orderNo',
    label: '订单编号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'mobile',
    label: '手机号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'state',
    label: '订单状态',
    component: 'Select',
    colProps: { span: 4 },
    componentProps: {
      options: [
        { label: '待报价', value: 0 },
        { label: '已报价', value:1},
        { label: '已支付', value: 2 },
        { label: '编译中', value: 3 },
        { label: '待确认', value: 4 },
        { label: '已完成', value: 5 },
        { label: '已取消', value: 100 },
      ],
    },
  },
  {
    field: 'startDate',
    label: '开始日期',
    component: 'DatePicker',
    colProps: { span: 4 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'DatePicker',
    colProps: { span: 4 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'isBj',
    label: '是否报价',
    component: 'Input',
    required: false,
    show: false,
  },
  {
    label: '订单编号',
    field: 'orderNo',
    component: 'Input',
    required: true,
    dynamicDisabled: true,
  },
  {
    label: '用户昵称',
    field: 'nickName',
    component: 'Input',
    required: false,
    dynamicDisabled: true,
  },
  {
    label: '种类',
    field: 'orderTypeName',
    component: 'Input',
    dynamicDisabled: true,
  },{
    label: '分区',
    field: 'partitionName',
    component: 'Input',
    dynamicDisabled: true,
  },{
    label: '电话',
    field: 'mobile',
    component: 'Input',
    dynamicDisabled: true,
  },{
    label: '微信',
    field: 'wechat',
    component: 'Input',
    dynamicDisabled: true,
  },{
    label: '邮箱',
    field: 'email',
    component: 'Input',
    dynamicDisabled: true,
  },{
    label: '编译要求',
    field: 'demand',
    component: 'InputTextArea',
    dynamicDisabled: true,
  }, {
    field: 'fileList',
    component: 'Input',
    label: '编译文件',
    slot: 'fileList',
  },{
    label: '报价',
    field: 'orderAmount',
    component: 'InputNumber',
    required: true,
    dynamicDisabled: ({ values }) => {
      if (values.isBj) {
        return false;
      } else {
        return true;
      }
    },
  },
  {
    label: '客户评价',
    field: 'evaluate',
    component: 'InputTextArea',
    dynamicDisabled: true,
  },
];

export const uploadSchema: FormSchema[] = [
  {
    field: 'fileIds',
    label: '文件ids',
    component: 'Input',
    required: false,
    show: false,
  },
  {
    label: '订单编号',
    field: 'orderNo',
    component: 'Input',
    required: true,
    dynamicDisabled: true,
  },
  {
    label: '用户昵称',
    field: 'nickName',
    component: 'Input',
    required: false,
    dynamicDisabled: true,
  },
  {
    label: '种类',
    field: 'orderTypeName',
    component: 'Input',
    dynamicDisabled: true,
  },{
    label: '分区',
    field: 'partitionName',
    component: 'Input',
    dynamicDisabled: true,
  },{
    label: '编译要求',
    field: 'demand',
    component: 'InputTextArea',
    dynamicDisabled: true,
  }, {
    field: 'fileList',
    component: 'Input',
    label: '编译文件',
    slot: 'fileList',
  },
  {
    label: '上传文件',
    component: 'FileUpload',
    required: false,
    componentProps: ({ formModel }) => {
      return {
        fileTag: 2,
        onChange: (value,fileIds) => {
          formModel.fileIds=fileIds;
        },
      };
    },
  },
];
